<template>
    <div class="detail">
        <h2>{{user.name}}</h2>
    </div>
</template>

<script setup>
    import api from '@/api/user'
    import {useRoute} from 'vue-router'
    const route = useRoute();   //获取路由参数
    const user = await api.find(route.params.id);
</script>

<style lang="scss" scoped>
    .detail {
        padding: 20px;
        background-color: #fff;
    }
</style>